import sqlite3 as sql
import warnings

class sqlite_connect:
    def __init__(self, database):
        """
        DESCRIPTION
            链接 Database 目录加下的指定数据库

        @param database:Database目录加下的指定数据库名称
        """
        print(database)
        self._myDb = sql.connect(fr"DataBase\{database}")
        self._cur = self._myDb.cursor()

    def execute_DML(self, sql):
        self._cur.execute(sql)
        self._myDb.commit()

    def execute_DQL(self, sql):
        # warnings.warn("some_old_function is deprecated", DeprecationWarning)
        return self._cur.execute(sql).fetchall()

    def close(self):
        self._myDb.close()


if __name__ == '__main__':
    connect = sqlite_connect("UserInfo.db3")
    connect.execute_DML("insert into UserInfo values ('test','test',0,0,0);")
    print(connect.execute_DQL("select * from UserInfo"))
